import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

const routes = [{
        path: '/login',
        name: 'login',
        component: () =>
            import ('./views/login'),
        meta: {
            name: 'login',
            title: '登录'
        }
    }, {
        path: '/',
        component: () =>
            import ('./views/Home.vue'),
        children: [{
                path: '/',
                redirect: '/home'
            },
            {
                path: 'home',
                name: 'home',
                component: () =>
                    import ('./views/Home/home.vue'),
                meta: {
                    name: 'home',
                    title: '首页',
                    keepAlive: true
                }
            }
        ]
    }, {
        path: '/basic',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'basic',
            title: '基础信息管理'
        },
        children: [{
            path: '/basic',
            redirect: '/projectlibrary'
        }, {
            path: 'projectlibrary',
            name: 'projectlibrary',
            component: () =>
                import ('./views/Basicinfor/ProjectLibrary'),
            meta: {
                name: 'projectlibrary',
                title: '项目库'
            },

        }, {
            path: 'enterpriselibrary',
            name: 'enterpriselibrary',
            component: () =>
                import ('./views/Basicinfor/EnterpriseLibrary'),
            meta: {
                name: 'enterpriselibrary',
                title: '企业库'
            },

        }, {
            path: 'EnterprisePersonnelBase',
            name: 'EnterprisePersonnelBase',
            component: () =>
                import ('./views/Basicinfor/EnterprisePersonnelBase'),
            meta: {
                name: 'EnterprisePersonnelBase',
                title: '企业人员库'
            },

        }, ]
    },
    {
        path: '/progress',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'progress',
            title: '前期工作管理'
        },
        children: [{
            path: 'ProgressWork',
            name: 'ProgressWork',
            component: () =>
                import ('./views/ProgressWork'),
            meta: {
                name: 'ProgressWork',
                title: '前期工作进展',

            },
        }, {
            path: 'DetailWork',
            name: 'DetailWork',
            component: () =>
                import ('./views/ProgressWork/DetailWork'),
            meta: {
                name: 'DetailWork',
                title: '前期工作进展详情'
            },

            children: [{
                    path: '/DetailWork',
                    redirect: 'ADetailsStudy'
                },
                {
                    path: 'ADetailsStudy',
                    name: 'ADetailsStudy',
                    component: () =>
                        import ('./views/ProgressWork/components/ADetailsStudy'),
                    meta: {
                        name: 'ADetailsStudy',
                        title: '可行性研究',
                    },
                }, {
                    path: 'BDesign',
                    name: 'BDesign',
                    component: () =>
                        import ('./views/ProgressWork/components/BDesign'),
                    meta: {
                        name: 'BDesign',
                        title: '初步设计',

                    },
                }, {
                    path: 'CPlans',
                    name: 'CPlans',
                    component: () =>
                        import ('./views/ProgressWork/components/CPlans'),
                    meta: {
                        name: 'CPlans',
                        title: '施工图设计',

                    },
                }, {
                    path: 'DRequirements',
                    name: 'DRequirements',
                    component: () =>
                        import ('./views/ProgressWork/components/DRequirements'),
                    meta: {
                        name: 'DRequirements',
                        title: '要件办理',

                    },
                }, {
                    path: 'ELot',
                    name: 'ELot',
                    component: () =>
                        import ('./views/ProgressWork/components/ELot'),
                    meta: {
                        name: 'ELot',
                        title: '标段管理',

                    },
                }, {
                    path: 'FService',
                    name: 'FService',
                    component: () =>
                        import ('./views/ProgressWork/components/FService'),
                    meta: {
                        name: 'FService',
                        title: '技术服务单位',

                    },
                }, {
                    path: 'GParty',
                    name: 'GParty',
                    component: () =>
                        import ('./views/ProgressWork/components/GParty'),
                    meta: {
                        name: 'GParty',
                        title: '第三方检测',

                    },
                }, {
                    path: 'HContract',
                    name: 'HContract',
                    component: () =>
                        import ('./views/ProgressWork/components/HContract'),
                    meta: {
                        name: 'HContract',
                        title: '合同管理',

                    },
                }, {
                    path: 'IPermit',
                    name: 'IPermit',
                    component: () =>
                        import ('./views/ProgressWork/components/IPermit'),
                    meta: {
                        name: 'IPermit',
                        title: '监督手续',

                    },
                }, {
                    path: 'JTechnology',
                    name: 'JTechnology',
                    component: () =>
                        import ('./views/ProgressWork/components/JTechnology'),
                    meta: {
                        name: 'JTechnology',
                        title: '施工许可',

                    },
                },
                // {
                //     path: 'Kmobilization',
                //     name: 'Kmobilization',
                //     component: () => import('./views/ProgressWork/components/Kmobilization'),
                //     meta: {
                //         name: 'Kmobilization',
                //         title: '施工进场'
                //     },
                // }
            ]
        }]
    }, {
        path: '/jurisdiction',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'jurisdiction',
            title: '权限管理'
        },
        children: [{
            path: 'menu',
            name: 'menu',
            component: () =>
                import ('./views/Jurisdiction/menu'),
            meta: {
                name: 'menu',
                title: '菜单'
            },

        }, {
            path: 'role',
            name: 'role',
            component: () =>
                import ('./views/Jurisdiction/role'),
            meta: {
                name: 'role',
                title: '角色'
            },

        }, {
            path: 'structure',
            name: 'structure',
            component: () =>
                import ('./views/Jurisdiction/structure'),
            meta: {
                name: 'structure',
                title: '组织架构'
            },

        }, {
            path: 'user',
            name: 'user',
            component: () =>
                import ('./views/Jurisdiction/user'),
            meta: {
                name: 'user',
                title: '用户'
            },

        }]
    }, {
        path: '/system',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'system',
            title: '系统管理'
        },
        children: [{
                path: 'systemLog',
                name: 'systemLog',
                component: () =>
                    import ('./views/System/systemLog'),
                meta: {
                    name: 'systemLog',
                    title: '系统日志'
                },

            },
            {
                path: 'dictionary',
                name: 'dictionary',
                component: () =>
                    import ('./views/System/dictionary'),
                meta: {
                    name: 'dictionary',
                    title: '数据字典'
                },

            },
        ]
    }, {
        path: '/homemanagement',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'homemanagement',
            title: '消息管理'
        },
        children: [
            // {
            //     path: 'Brief',
            //     name: 'Brief',
            //     component: () => import('./views/HomeManagement/Brief'),
            //     meta: {
            //         name: 'Brief',
            //         title: '项目简报'
            //     },

            // },
            {
                path: 'documents',
                name: 'documents',
                component: () =>
                    import ('./views/HomeManagement/documents'),
                meta: {
                    name: 'documents',
                    title: '收发文'
                },

            },
            {
                path: 'notice',
                name: 'notice',
                component: () =>
                    import ('./views/HomeManagement/notice'),
                meta: {
                    name: 'notice',
                    title: '通知公告'
                },

            },
        ]
    }, {
        path: '/ThinkTank',
        component: () =>
            import ('./views/Home.vue'),
        meta: {
            name: 'ThinkTank',
            title: '智库管理'
        },
        children: [{
                path: 'classification',
                name: 'classification',
                component: () =>
                    import ('./views/ThinkTank/classification'),
                meta: {
                    name: 'classification',
                    title: '智库分类管理'
                },

            },
            {
                path: 'ThinkTankDocuments',
                name: 'ThinkTankDocuments',
                component: () =>
                    import ('./views/ThinkTank/ThinkTankDocuments'),
                meta: {
                    name: 'ThinkTankDocuments',
                    title: '智库文章管理'
                },

            },
        ]
    },

]



const router = new VueRouter({
    routes
})

export default router